package cn.iocoder.yudao.module.system.controller.admin.mini.other.lottery.dal.mysql.lottery;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.system.controller.admin.mini.other.lottery.controller.admin.lottery.vo.LotteryExportReqVO;
import cn.iocoder.yudao.module.system.controller.admin.mini.other.lottery.controller.admin.lottery.vo.LotteryPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.mini.other.lottery.dal.dataobject.lottery.LotteryDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 抽奖 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface LotteryMapper extends BaseMapperX<LotteryDO> {

    default PageResult<LotteryDO> selectPage(LotteryPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<LotteryDO>()
                .betweenIfPresent(LotteryDO::getCreateTime, reqVO.getCreateTime())
                .likeIfPresent(LotteryDO::getName, reqVO.getName())
                .eqIfPresent(LotteryDO::getTid, reqVO.getTid())
                .orderByDesc(LotteryDO::getId));
    }

    default List<LotteryDO> selectList(LotteryExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<LotteryDO>()
                .betweenIfPresent(LotteryDO::getCreateTime, reqVO.getCreateTime())
                .likeIfPresent(LotteryDO::getName, reqVO.getName())
                .orderByDesc(LotteryDO::getId));
    }

}
